<?php
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
get_config_keytable("workclass");
empty($do) && $do = 'list';
	if (user_union_id!='') {
		$wheresqls = " unionid='".user_union_id."'";
	}else{
		$wheresqls = " unionid='".union_id."'";
	}
if ($do == 'list') {
	$id = getGP('id','G','int');
	$blog = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."workclass  WHERE id = '$id' and ".$wheresqls."");
	//获取模块
	$tpl = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."workclass_template  WHERE id = '".$blog['worktemplate']."' and ".$wheresqls."");
	if($tpl['tempkey']=='3'){
		include_once('tpl/'.str_replace(".php","_view.php",trim($tpl['tmpaddr'])));
	}else{
		include_once('template/views.php');
	}
	
}elseif ($do == 'flow') {
	$id = getGP('id','G','int');
	$blog = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."workclass  WHERE id = '$id' and ".$wheresqls."");
	//获取模块
	$tpl = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."workclass_template  WHERE id = '".$blog['worktemplate']."' and ".$wheresqls."");
	include_once('template/views_flow.php');
}elseif ($do == 'word') {
	$word=new word;
	$word->start();
	$id = getGP('id','G','int');
	$blog = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."workclass  WHERE id = '$id' and ".$wheresqls."");
	//获取模块
	$tpl = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."workclass_template  WHERE id = '".$blog['worktemplate']."' and ".$wheresqls."");
	if($tpl['tempkey']=='3'){
		include_once('tpl/'.str_replace(".php","_word.php",trim($tpl['tmpaddr'])));
	}else{
		include_once('template/views.php');
	}
	$word->save("wordfile/".$blog['number'].".doc");
	goto_page('down.php?urls=wordfile/'.$blog['number'].'.doc');
}
?>